import {
  createRouter,
  createWebHashHistory,
  createMemoryHistory,
} from "vue-router";
import store from "../store";

import routerView from "../layout/";
import { routerList, subRouter } from "./routerModule";

const routes = [
  {
    name: "login",
    path: "/login",
    component: () => import("../views/login"),
  },
  {
    name: "/",
    redirect: "/home",
    path: "/",
    component: () => routerView,
    children: [...routerList],
  },
  // 二级菜单
  ...subRouter,
];

const router = createRouter({
  history: createWebHashHistory(),
  // base: process.env.BASE_URL,
  routes,
});

export default router;
